/**
 * 基础角色，便于扩展多个角色
 */

module.exports = function (start, work, end) {
    // 返回一个生命函数，组织运行
    /** @param {Creep} creep */
    return function (creep) {
        if (!creep.memory.status)
            creep.memory.status = 1;
        // 准备阶段
        if (creep.memory.status == 1) {
            creep.memory.status = start(creep);
        }
        // 工作阶段
        else if (creep.memory.status == 2) {
            creep.memory.status = work(creep);
        }
        // 结束阶段
        else if (creep.memory.status == 3) {
            creep.memory.status = end(creep);
        }
        else {
            console.log(creep.name + '状态异常');
        }
    }
};